﻿Public Class frmBaoCao

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim sql As String = "select * from BaoCao"
        Dim DATA As New ketnoidulieu()
        dgvbaocao.DataSource = DATA.ExcuteDataTable(sql)
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim sql As String = String.Format("select * from BaoCao where  MaNhanVien='{0}' or MaHoaDon='{1}' or MaBaoCao='{2}'", txtmnv.Text, txtmhd.Text, txtbc.Text)
        Dim DATA As New ketnoidulieu()
        dgvbaocao.DataSource = DATA.ExcuteDataTable(sql)
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim sql As String = String.Format("Insert into Nha(MaNhanVien, MaHoaDon, SoTien,SoTienNo,MaBaoCao) values ('" & txtNhanVien.Text & "','" & txthoadon.Text & "', '" & txtsotien.Text & "','" & txtsotienno.Text & "','" & txtmabaocao.Text & "')")
        Dim INS As New ketnoidulieu()
        INS.SQL_ExecuteNonQuery(sql)
        Dim sl As String = "select * from BaoCao"
        dgvbaocao.DataSource = INS.ExcuteDataTable(sl)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If txtmabaocao.Text = "" Then
            MsgBox(" Bạn Phải Nhập Giá Trị Cấn Xóa MaBAOCAO!!! ")
        Else
            Dim sql As String = String.Format("delete * from BaoCao where MaBaoCao = '" & txtmabaocao.Text & "'")
            Dim KN As New ketnoidulieu()
            KN.SQL_ExecuteNonQuery(sql)
            Dim sl As String = "select * from BaoCao"
            dgvbaocao.DataSource = KN.ExcuteDataTable(sl)
        End If
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim sql As String = String.Format("Update Nha Set  MaNhanVien ='{0}', MaHoaDon ='{1}',SoTien='{2}',SoTienNo='{3}' where MaBaoCao = '" & txtmabaocao.Text & "'", txtNhanVien.Text, txthoadon.Text, txtsotien.Text, txtsotienno.Text)
        Dim INS As New ketnoidulieu()
        INS.SQL_ExecuteNonQuery(sql)
        Dim sl As String = "select * from BaoCao"
        dgvbaocao.DataSource = INS.ExcuteDataTable(sl)
    End Sub
End Class